[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
                                 Data  Types 
                                Compatibility 

 Type Compatibility 

     Compatibility is sometimes desired between different types for use in
     expressions or relational operations.  Type compatibility is important
     as a precondition of assignment compatibility.  Type compatibility
     exists when at least one of the following conditions are true:

        Both types are the same

        Both types are real types

        Both types are integer types

        One type is a subrange of the other

        Both types are subranges of the same host type

        Both types are set types with compatable base types

        Both types are packed string types with an identical number
        of components

        One type is a string type and the other is a string type, packed
        string type, or char type.

        One type is pointer and the other is any pointer type.

        Both types are procedure types with identicle result types, the
        same number of parameters, and a one-to-one identity between
        parameter types.

 Assignment Compatibility 

     Assignment compatibility becomes necessary in assignment statements or
     when passing value parameters.  Two types are assignment compatibile,
     (T1 = T2 is allowed) if at least one of the following are true:


        T1 is Real type and T2 is an Integer type

        T1 and T2 are both String types

        T1 is a String type and T2 is a Char type

        T1 is a String type and T2 is a Packed String type

        T1 and T2 are compatible Packed String types

        T1 and T2 are compatible Pointer types

        T1 and T2 are compatible Procedure types

        T1 is a Procedure type and T2 is a Procedure or Function with an
        identical result type, the same number of parameters, and a
        one-to-one identity between parameter types.

        T1 and T2 are compatible Set types and all of the members of the
        value of type T2 are within the range of possible values of T1

        T1 and T2 are identical types and neither is a file type, or a
        structured type that contains a file type component at any level

        T1 and T2 are compatible ordinal types, and the values of type T2
        are within the range of possible values of T1

        T1 and T2 are Real types and the values of type T2 are within the
        range of possible values of T1

        An object type T2 is assignment compatible with an object type T1
        if T2 is in the domain of T1.

        A pointer type P2, pointing to an object type T2, is assignment
        compatible with a pointer type P1, pointing to an object type T1,
        if T2 is in the domain of T1.

See Also: Data Types Type Declarations
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson